﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FubiManger.Pad
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class Pprocontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public Pprocontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        int count = 0;
        /// <summary>
        /// 封面
        /// </summary>
        public string cover { get; set; }
        /// <summary>
        /// 商品名
        /// </summary>
        public string gdname { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        public string describes { get; set; }
        /// <summary>
        /// 市场价
        /// </summary>
        public string market_price { get; set; }
        /// <summary>
        /// 销售价
        /// </summary>
        public double price { get; set; }
        /// <summary>
        /// 商品ID
        /// </summary>
        public string gdid { get; set; }
        /// <summary>
        /// 1预览2点餐3加单
        /// </summary>
        public string stype { get; set; }
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void panadd_Press(object sender, EventArgs e)
        {
            count++;
            lblcount.Text = count.ToString();
            if (stype == "2")
                ((PorderfoodForm)this.Form).Addpro(gdname, cover, price, count);
            else
                ((porderfoodcontrol)this.Owner.Owner.Owner.Owner).Addpro(gdname, cover, price, count);
        }

        /// <summary>
        /// 减少
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pancut_Press(object sender, EventArgs e)
        {
            if (count > 0)
                count--;
            lblcount.Text = count.ToString();
            if (stype == "2")
                ((PorderfoodForm)this.Form).Delpro(gdname);//减商品
            else
                ((porderfoodcontrol)this.Owner.Owner.Owner.Owner).Delpro(gdname);//减商品
        }

        private void Pprocontrol_Load(object sender, EventArgs e)
        {
            lblname.Text = gdname;//商品名称
            lblmoney.Text = "￥" + price + "/份";//销售价   
            imgcover.ResourceID = @"c:\fbimage\" + cover;//封面
        }
    }
}